package org.binarylook.boss
{
	
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.http.HTTPService;
	
	
	
	
	public class HTTPYAPI
	{
		
		
		
		private var entrybean:ispider;
		
		
		public function HTTPYAPI(){
			
			
		}
		
		
		public function  ReqBOSS(strURI:String,argbean:ispider):void{
			
			this.entrybean 	= argbean;
			
			var beanHTTPS:HTTPService 	= new HTTPService(); 
			beanHTTPS.method			= "GET";
			beanHTTPS.url				= strURI;
			beanHTTPS.resultFormat		= "xml";
			beanHTTPS.addEventListener("result",this.YBOSSSUCEESS);
			beanHTTPS.addEventListener("falut",this.YBOSSFAILURE);
			beanHTTPS.send();

		}
		
		
		public function YBOSSSUCEESS(event:ResultEvent):void{
			
			
			namespace ns2		=	"http://www.inktomi.com/";
			use namespace ns2;

			var xmlnsPattern:RegExp = new RegExp("xmlns[^\"]*\"[^\"]*\"", "gi");
					
							
			var strTemp:String = event.result.toString().replace(xmlnsPattern,"");
			
			trace("Output"+strTemp);
	
			var strxml:XML		= new XML(strTemp);
			var ns:Namespace	=  strxml.namespace();
			
			strxml.removeNamespace(ns);
			
			var xmlist:XMLList		= strxml.resultset_web.result;
         	
         	this.entrybean.searchResult(xmlist);
         	
       }
		
		public function YBOSSFAILURE(event:FaultEvent):void{
			Alert.show("failure");
		
		}
		
		
		
	}
}